﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


using Entity;

namespace SalesVMT
{
    public partial class frmItemReport : Form
    {
        DialogResult dlgResult;
        string _ItemType ="";

        public string ItemType
        {
            get { return _ItemType; }
            set { _ItemType = value; }
        }
        string _PriceType;

        public string PriceType
        {
            get { return _PriceType; }
            set { _PriceType = value; }
        }
        public frmItemReport()
        {
            InitializeComponent();
            this.KeyPreview = true;
            dlgResult = DialogResult.Cancel;
        }
        bool CheckValid()
        {
            if (!radAllItem.Checked && !radOneItem.Checked)
            {
                MessageBox.Show("Chưa lựa chọn sản phẩm!", Message.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            if (!radPrice1.Checked && !radPrice2.Checked)
            {
                MessageBox.Show("Chưa lựa chọn loại báo giá!", Message.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            return true;
        }
        private void btnView_Click(object sender, EventArgs e)
        {
            if (!CheckValid())
                return;
            if (radOneItem.Checked)
                _ItemType = "SP DA CHON";
            if (radPrice1.Checked)
                _PriceType = "BAO GIA BAN BUON";
            else
                _PriceType = "BAO GIA BAN LE";
            dlgResult = DialogResult.OK;
            this.Close();
        }

        private void frmItemReport_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Enter:
                    if (!e.Alt && !e.Control)
                    {
                        this.ProcessTabKey(!e.Shift);
                        e.Handled = true;
                    }
                    break;
                case Keys.Escape:
                    this.Dispose();
                    this.DialogResult = dlgResult;
                    this.Close();
                    break;
            }
        }



        private void frmItemReport_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.DialogResult = dlgResult;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            dlgResult = DialogResult.Cancel;
            this.Close();
        }



    }
}